Skip to content

Conversation

@dougfabris
Copy link
Member

@dougfabris dougfabris commented Sep 22, 2025

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • New Features
    • Added support for cancelling in-flight endpoint requests via an optional abort signal, improving responsiveness during rapid navigation or component unmounts.
    • Endpoint hook now accepts an optional options parameter with a signal so callers can abort pending requests and avoid stale UI updates.
    • Internal data-fetching now propagates cancellation through query contexts for cleaner request lifecycle handling.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Sep 22, 2025

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is targeting the wrong base branch. It should target 7.12.0, but it targets 7.11.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Sep 22, 2025

⚠️ No Changeset found

Latest commit: dc41e58

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 22, 2025

Walkthrough

callEndpoint now accepts an optional AbortSignal and this signal is threaded from hooks and client providers into endpoint calls; useEndpoint and a query hook forward the signal, and ServerProvider passes it into REST SDK calls for cancellation support.

Changes

Cohort / File(s) Summary of Changes
Server context API
packages/ui-contexts/src/ServerContext.ts
Added signal?: AbortSignal to the callEndpoint args in ServerContextValue interface.
Hook types & forwarding
packages/ui-contexts/src/hooks/useEndpoint.ts
Added EndpointOptions { signal?: AbortSignal }; updated EndpointFunction and useEndpoint to accept options? and forward options?.signal to callEndpoint.
React Query usage
apps/meteor/client/apps/gameCenter/hooks/useExternalComponentsQuery.ts
Changed queryFn to accept { signal } and pass { signal } into getExternalComponents to enable cancellation.
Client provider REST propagation
apps/meteor/client/providers/ServerProvider.tsx
Updated callEndpoint signature to include signal?: AbortSignal and pass { signal } through to sdk.rest.get/post/put/delete calls.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor UI as UI Component
  participant H as useEndpoint / useQuery
  participant SC as ServerContext.callEndpoint
  participant SP as ServerProvider
  participant SDK as REST SDK / Endpoint Handler

  UI->>H: invoke endpoint(args, options{signal?}) / start query
  H->>SC: callEndpoint({...args, signal: options?.signal / signal from query})
  SC->>SP: delegate request(method, path, params, signal)
  SP->>SDK: sdk.rest.<method>(..., { signal })
  SDK-->>SP: response / abort
  alt Abort signaled
    SDK-->>SP: AbortError
    SP-->>SC: propagate AbortError
    SC-->>H: Promise rejected (AbortError)
    H-->>UI: propagate rejection / cancel
  else Completed
    SDK-->>SP: result
    SP-->>SC: serialized result
    SC-->>H: Promise<Serialized<Result>>
    H-->>UI: deliver result
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

A whisk of wind, a hush, a ping—
I pass the signal on my spring.
Hooks and context hear the call,
Provider stops the request mid-fall.
Rabbit hops, the pipeline sings. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title accurately references adding options to the useEndpoint hook but does not convey the broader enhancement of propagating AbortSignal support through callEndpoint in ServerContext and ServerProvider across the endpoint stack.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/useEndpoint-abortSignal

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🧪 Early access (Sonnet 4.5): enabled

We are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience.

Note:

  • Public repositories are always opted into early access features.
  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.

Comment @coderabbitai help to get the list of available commands and usage tips.

@dougfabris dougfabris added this to the 7.11.0 milestone Sep 22, 2025
@codecov
Copy link

codecov bot commented Sep 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.39%. Comparing base (5e821ad) to head (dc41e58).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37020      +/-   ##
===========================================
+ Coverage    67.37%   67.39%   +0.02%     
===========================================
  Files         3330     3330              
  Lines       113482   113482              
  Branches     20598    20607       +9     
===========================================
+ Hits         76454    76480      +26     
+ Misses       34418    34394      -24     
+ Partials      2610     2608       -2     
Flag Coverage Δ
e2e 57.32% <100.00%> (+<0.01%) ⬆️
e2e-api 40.55% <ø> (+0.02%) ⬆️
unit 71.16% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dougfabris dougfabris marked this pull request as ready for review September 22, 2025 16:59
@dougfabris dougfabris requested a review from a team as a code owner September 22, 2025 16:59
@tassoevan tassoevan force-pushed the chore/useEndpoint-abortSignal branch from d9a26d5 to 0a85bbd Compare September 22, 2025 22:21
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
apps/meteor/client/providers/ServerProvider.tsx (1)

61-61: Optional: support cancellation for uploads, too.

If sdk.rest.post accepts { signal }, consider threading it here in a follow‑up to keep behavior consistent.

-const uploadToEndpoint = (endpoint: PathFor<'POST'>, formData: any): Promise<UploadResult> => sdk.rest.post(endpoint as any, formData);
+const uploadToEndpoint = (
+  endpoint: PathFor<'POST'>,
+  formData: any,
+  options?: { signal?: AbortSignal },
+): Promise<UploadResult> => sdk.rest.post(endpoint as any, formData, options);

Note: This changes the public signature; update ServerContextValue accordingly if adopted.

apps/meteor/client/apps/gameCenter/hooks/useExternalComponentsQuery.ts (1)

9-11: LGTM: query cancellation is correctly wired.

Forwarding React Query’s { signal } into useEndpoint enables proper aborts.

You could use select to project the field and keep the fetcher simpler:

-    queryFn: async ({ signal }) => {
-      return (await getExternalComponents(undefined, { signal })).externalComponents;
-    },
+    queryFn: ({ signal }) => getExternalComponents(undefined, { signal }),
+    select: (data) => data.externalComponents,
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d9a26d5 and 0a85bbd.

📒 Files selected for processing (2)
  • apps/meteor/client/apps/gameCenter/hooks/useExternalComponentsQuery.ts (1 hunks)
  • apps/meteor/client/providers/ServerProvider.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/meteor/client/providers/ServerProvider.tsx (2)
packages/rest-typings/src/index.ts (3)
  • UrlParams (202-208)
  • OperationParams (194-196)
  • OperationResult (198-200)
apps/meteor/app/utils/client/lib/SDKClient.ts (1)
  • sdk (271-271)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (1)
apps/meteor/client/providers/ServerProvider.tsx (1)

28-40: AbortSignal threading looks good; verify upstream type surface matches.

Sandbox lacked repository files — run these locally to confirm ServerContextValue and useEndpoint typings expose signal?: AbortSignal (and that callers don't fall back to any):

rg -nP -C2 --type=ts 'callEndpoint\s*:\s*<[^>]+>\s*\(\s*\{[^}]*signal\?:\s*AbortSignal' packages/ui-contexts/src/ServerContext.ts
rg -nP -C2 --type=ts 'type\s+EndpointOptions\s*=\s*\{\s*signal\?:\s*AbortSignal' packages/ui-contexts/src/hooks/useEndpoint.ts

@dougfabris dougfabris modified the milestones: 7.11.0, 7.12.0 Sep 24, 2025
@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label Sep 30, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Sep 30, 2025
@kodiakhq kodiakhq bot merged commit affd1ac into develop Sep 30, 2025
49 checks passed
@kodiakhq kodiakhq bot deleted the chore/useEndpoint-abortSignal branch September 30, 2025 20:23
debdutdeb pushed a commit that referenced this pull request Oct 7, 2025
Co-authored-by: Tasso Evangelista <2263066+tassoevan@users.noreply.github.com>
juliajforesti pushed a commit that referenced this pull request Oct 8, 2025
Co-authored-by: Tasso Evangelista <2263066+tassoevan@users.noreply.github.com>
juliajforesti pushed a commit that referenced this pull request Oct 8, 2025
Co-authored-by: Tasso Evangelista <2263066+tassoevan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants